package cn.yqx.bankshop.oauth2.service;


import cn.yqx.bankshop.oauth2.service.fallback.UserServiceFallbackFactory;
import cn.yqx.bankshop.user.pojo.BuUserInfo;
import cn.yqx.bankshop.user.pojo.LoginShopUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(value="bankshop-user-service", fallback = UserServiceFallbackFactory.class)
public interface UserService {

    @GetMapping(value = "/api/v1/user-auth/username")
    BuUserInfo selectByUsername(@RequestParam("username") String username);

    /**
     * feign rpc访问远程/users-anon/login接口
     * @param username
     * @return
     */

    @GetMapping(value = "/api/v1/user-auth/username")
    LoginShopUser findByUsername(@RequestParam("username") String username);

    /**
     * 通过手机号查询用户、角色信息
     *
     * @param mobile 手机号
     */
    @GetMapping(value = "/api/v1/user-auth/mobile")
    LoginShopUser findByMobile(@RequestParam("mobile") String mobile);

    /**
     * 根据OpenId查询用户信息
     * @param openId openId
     */
    @GetMapping(value = "/api/v1/user-auth/openId")
    LoginShopUser findByOpenId(@RequestParam("openId") String openId);
}

